package com.wxl.common.room.converter

import android.text.TextUtils
import androidx.room.TypeConverter
import com.alibaba.fastjson.JSONArray
import com.wxl.common.room.entity.LeiGuanBlastEntity
import java.util.*

class BlastLgRecordTypeConverter {

    @TypeConverter
    fun stringToSomeObjectList(data:String) : ArrayList<LeiGuanBlastEntity> {
        if (TextUtils.isEmpty(data)) {
            return arrayListOf()
        }
        return JSONArray.parseArray(data, LeiGuanBlastEntity::class.java) as ArrayList
    }

    @TypeConverter
    fun someObjectListToString(someObjects: ArrayList<LeiGuanBlastEntity> ) :String{
        return JSONArray.toJSONString(someObjects)
    }
}